package zw.car.server.netty.util;


/**
 * 创建人:zhuwei
 * 邮箱:121203654@qq.com
 * 创建时间:2018-10-23 09:51
 */
public class ArrayUtils {

    public static byte[] addAll(byte[]... arrays) {
        if (arrays.length == 1) {
            return arrays[0];
        }

        int length = 0;
        for (byte[] array : arrays) {
            if (array == null) {
                continue;
            }
            length += array.length;
        }
        byte[] result = new byte[length];

        length = 0;
        for (byte[] array : arrays) {
            if (array == null) {
                continue;
            }
            System.arraycopy(array, 0, result, length, array.length);
            length += array.length;
        }
        return result;
    }
}
